package com.ql.dao;

import com.ql.domain.request.SelectTemplate;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface SelectTemplateDao {


    @Select("select * from select_template where userId =#{id}")
    List<SelectTemplate> findByUserId(String id);

    /**
     * 根据当前用户id和select下拉框value值查询
     *
     * @param value
     * @return
     */
    @Select("select * from select_template where selectValue=#{value} and  userId =#{userId}")
    SelectTemplate findTemplate(@Param("value")String value, @Param("userId") String userId);



    /**
     * 根据value值和userId更新模板
     *
     * @param selectTemplate
     * @return
     */

    @Update("update select_template set stakeMark=#{stakeMark},pileLength=#{pileLength},pileLength2=#{pileLength2},to_drill_avs=#{to_drill_avs},to_drill_ave=#{to_drill_ave}, rih_avs=#{rih_avs}, rih_ave=#{rih_ave},  maxdls=#{maxdls}, maxdle=#{maxdle},average_aols=#{average_aols},average_aole=#{average_aole},water_cement_ratios=#{water_cement_ratios},water_cement_ratioe=#{water_cement_ratioe},  pile_times=#{pile_times}, pile_time_end=#{pile_time_end},slopes=#{slopes},slope_end=#{slope_end}, where selectValue=#{selectValue}  and userId=#{userId}")
    int update(SelectTemplate selectTemplate);

    /**
     * 根据value值和userId删除模板
     *
     * @param selectTemplate
     * @return
     */
    @Delete("delete from select_template where selectValue=#{selectValue} and userId=#{userId}")
    int del(SelectTemplate selectTemplate);

    /**
     * 不知道能不能用
     *
     * @param selectTemplate
     * @return
     */
    @Insert("insert into select_template  values(#{id},#{selectName},#{selectValue},#{stakeMark},#{pileLength},#{pileLength2},#{to_drill_avs},#{to_drill_ave},#{rih_avs},#{rih_ave},#{maxdls},#{maxdle},#{average_aols},#{average_aole},#{water_cement_ratios},#{water_cement_ratioe},#{pile_times},#{pile_time_end},#{slopes},#{slope_end},#{userId})")
    int add(SelectTemplate selectTemplate);
}
